package com.bestcem.xm.user.controller.vo.user.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import javax.validation.constraints.*;
import java.util.List;

import static com.bestcem.xm.user.constant.BusinessConstant.USERNAME_MAX_LENGTH;

/**
 * @author Linked <zhijian.lin@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/1 15:30
 */
@Data
public class UpdateUserAccountVO {

    @NotNull(message = "status缺失", groups = {UpdateUserStatusGroup.class, UpdateUserAccountGroup.class})
    @Min(value = 0, message = "status范围0~2", groups = {UpdateUserStatusGroup.class, UpdateUserAccountGroup.class})
    @Max(value = 2, message = "status范围0~2", groups = {UpdateUserStatusGroup.class, UpdateUserAccountGroup.class})
    private Integer status;

    /**
     * 账号
     */
    @NotBlank(message = "userName缺失", groups = {UpdateUserAccountGroup.class})
    @Size(max = USERNAME_MAX_LENGTH, message = "账号名长度不能超过60！", groups = {UpdateUserAccountGroup.class})
    private String userName;

    /**
     * 姓名
     */
    @NotBlank(message = "name缺失", groups = {UpdateUserAccountGroup.class})
    @Size(max = USERNAME_MAX_LENGTH, message = "姓名长度不能超过60！", groups = {UpdateUserAccountGroup.class})
    private String name;

    /**
     * 邮箱
     */
    @NotBlank(message = "email", groups = {UpdateUserAccountGroup.class})
    private String email;

    /**
     * 角色列表
     */
    @NotNull(message = "roleList is required", groups = {UpdateUserAccountGroup.class})
    @Size(min = 1, message = "roleList 至少一个", groups = {UpdateUserAccountGroup.class})
    private List<String> roleList;

    /**
     * 绑定组织列表
     */
    @NotNull(message = "group_id_list is required", groups = {UpdateUserAccountGroup.class})
    @Size(min = 1, message = "group_id_list 至少一个", groups = {UpdateUserAccountGroup.class})
    @JsonProperty("group_id_list")
    private List<String> groupIdList;

    /**
     * 手机
     */
    @JsonProperty("mobile")
    private String phone;

    /**
     * 备注
     */
    @Size(max = USERNAME_MAX_LENGTH, message = "备注长度不能超过60！", groups = {UpdateUserAccountGroup.class})
    private String content;
}